/*
 * @Description: 
 * @Project: 
 * @Author: michelle
 * @Date: 2022-02-23 16:27:30
 * @LastEditors: michelle
 * @LastEditTime: 2022-02-23 16:27:30
 * @Modified By: michelle
 * @FilePath: /vite-project/src/utils/helper.jsx
 */
// 全屏浏览器
export function fullscreen() {
    try {
        const docElm = document.documentElement
        if (docElm.requestFullscreen) {
            docElm.requestFullscreen()
        } else if (docElm.webkitRequestFullScreen) {
            docElm.webkitRequestFullScreen()
        } else if (docElm.mozRequestFullScreen) {
            docElm.mozRequestFullScreen()
        } else if (docElm.msRequestFullscreen) {
            docElm.msRequestFullscreen()
        }
    } catch {
        message.warn('您所使用的浏览器不支持全屏')
    }
}

// 退出全屏浏览器
export function exitFullscreen() {
    try {
        const doc = document
        if (doc.exitFullscreen) {
            doc.exitFullscreen()
        } else if (doc.mozCancelFullScreen) {
            doc.mozCancelFullScreen()
        } else if (doc.webkitCancelFullScreen) {
            doc.webkitCancelFullScreen()
        } else if (doc.msExitFullscreen) {
            doc.msExitFullscreen()
        }
    } catch {
        message.warn('您所使用的浏览器不支持退出全屏, 请按ESC')
    }
}
